<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<title>孵化器基本信息管理 - ${siteName}</title>
	<meta name="description" content="">
	<meta name="author" content="xuzewei">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="css/cloud-admin.css" >
	<link rel="stylesheet" type="text/css" href="css/themes/default.css" id="skin-switcher" >
	<link rel="stylesheet" type="text/css" href="css/responsive.css" >
	<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css">
	<!-- JQUERY UI-->
	<link rel="stylesheet" type="text/css" href="js/jquery-ui-1.10.3.custom/css/custom-theme/jquery-ui-1.10.3.custom.min.css" />
	<!-- DATE RANGE PICKER -->
	<link rel="stylesheet" type="text/css" href="js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<!-- JQGRID -->
	<link rel="stylesheet" type="text/css" href="js/jqgrid/css/ui.jqgrid.min.css" />
	<!-- HUBSPOT MESSENGER -->
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger.min.css" />
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger-theme-flat.min.css" />
</head>
<body id="app" ng-app="app" ng-controller="ctrl">
	<!-- HEADER -->
	<jsp:include page="include/header.jsp" />
	<!--/HEADER -->
	<!-- PAGE -->
	<section id="page">
		<!-- SIDEBAR -->
		<jsp:include page="include/sidebar.jsp" />
		<!-- /SIDEBAR -->
		<div id="main-content">
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">
						<!-- PAGE HEADER-->
						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="welcome.jsp">Home</a>
										</li>
									</ul>
									<!-- /BREADCRUMBS -->
									<div class="clearfix">
										<h3 class="content-title pull-left">
										孵化器基本信息管理
										</h3>
										<a href="javascript:;" class="reload" ng-click="reload()">
											<i class="fa fa-refresh"></i>
										</a>
									</div>
									<div class="description"></div>
								</div>
							</div>
						</div>
						<!-- /PAGE HEADER -->
						<div class="box-body big">
							<form role="form">
								<div class="form-group">
								  <label>名称</label>
								  <input type="text" class="form-control" ng-model="resp.name" ng-readonly="true">
								</div>
								<div class="form-group">
								  <label>省/直辖市</label>
								  <select ng-model="resp.provinceCode" class="form-control" ng-options="o.code as o.name for o in provinceList" ng-readonly="true">
								  	<option value="">-- 请选择省/直辖市 --</option>
								  </select>
								</div>
								<div class="form-group">
								  <label>地址</label>
								  <input type="text" class="form-control" ng-model="resp.addr">
								</div>
								<div class="form-group">
								  <label>联系电话</label>
								  <input type="text" class="form-control" ng-model="resp.phone">
								</div>
								<div class="form-group">
								  <label>简介</label>
								  <input type="text" class="form-control" ng-model="resp.desc">
								</div>
								<div class="form-group">
								  <label>入住简介</label>
								  <input type="text" class="form-control" ng-model="resp.checkInDesc">
								</div>
								<!-- <div class="form-group">
								  <label>二维码</label>
								  <input type="text" class="form-control" ng-model="resp.qrcodeUrl">
								</div> -->
								<div class="form-group">
								  <label>-- 微信连接信息，可从微信公众号后台查询 --</label>
								</div>
								<div class="form-group">
								  <label>微信AppId</label>
								  <input type="text" class="form-control" ng-model="resp.weixinAppId">
								</div>
								<div class="form-group">
								  <label>微信AppSecret</label>
								  <input type="text" class="form-control" ng-model="resp.weixinAppSecret">
								</div>
								<div class="form-group">
								  <label>微信Token</label>
								  <input type="text" class="form-control" ng-model="resp.weixinToken">
								</div>
								<div class="form-group">
								  <label>微信EncodingAesKey</label>
								  <input type="text" class="form-control" ng-model="resp.weixinEncodingAesKey">
								</div>
								<div class="form-group">
								  <label>微信mcId</label>
								  <input type="text" class="form-control" ng-model="resp.weixinMchId">
								</div>
								<div class="form-group">
								  <label>微信signKey</label>
								  <input type="text" class="form-control" ng-model="resp.weixinSignKey">
								</div>
								<div class="form-group">
								  <label>你的站点</label>
								  <input type="text" class="form-control" ng-model="resp.website">
								</div>
								<div class="form-group">
								  <label>-- 微信H5跳转页 --</label>
								  <label>请在你每个连入微信的接口加入（?memberId={{resp.memberId}}）</label>
								</div>
								<div class="form-group">
								  <label>会员服务</label>
								  <input type="text" class="form-control" ng-model="resp.weixinH5UrlMembershipService">
								</div>
								<div class="form-group">
								  <label>便利服务</label>
								  <input type="text" class="form-control" ng-model="resp.weixinH5UrlConvenienceService">
								</div>
								<div class="form-group">
								  <label>活动</label>
								  <input type="text" class="form-control" ng-model="resp.weixinH5UrlEvent">
								</div>
								<div class="form-group">
								  <label>干货分享</label>
								  <input type="text" class="form-control" ng-model="resp.weixinH5UrlArticle">
								</div>
								<div class="form-group">
								  <label>创业服务</label>
								  <input type="text" class="form-control" ng-model="resp.weixinH5UrlEntrepreneurService">
								</div>
								<div class="form-group">
								  <label>合作伙伴</label>
								  <input type="text" class="form-control" ng-model="resp.weixinH5UrlEntrepreneur">
								</div>
								<div class="form-group">
								  <label>入孵企业</label>
								  <input type="text" class="form-control" ng-model="resp.weixinH5UrlPartner">
								</div>
								<button type="submit" class="btn btn-danger" ng-click="submit()">提交</button>
							</form>
						</div>
						<div class="footer-tools">
							<span class="go-top">
								<i class="fa fa-chevron-up"></i> Top
							</span>
						</div>
					</div><!-- /CONTENT-->
				</div>
			</div>
		</div>
	</section>
	<!--/PAGE -->
	
	<!-- JAVASCRIPTS -->
	<!-- Placed at the end of the document so the pages load faster -->
	<!-- JQUERY -->
	<script src="js/jquery/jquery-2.0.3.min.js"></script>
	<!-- JQUERY UI-->
	<script src="js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"></script>
	<!-- BOOTSTRAP -->
	<script src="bootstrap-dist/js/bootstrap.min.js"></script>
	<!-- DATE RANGE PICKER -->
	<script src="js/bootstrap-daterangepicker/moment.min.js"></script>
	<script src="js/bootstrap-daterangepicker/daterangepicker.min.js"></script>
	<!-- SLIMSCROLL -->
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js"></script>
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js"></script>
	<!-- BLOCK UI -->
	<script type="text/javascript" src="js/jQuery-BlockUI/jquery.blockUI.min.js"></script>
	<!-- JQGRID -->
	<script type="text/javascript" src="js/jqgrid/js/grid.locale-en.min.js"></script>
	<script type="text/javascript" src="js/jqgrid/js/jquery.jqGrid.min.js"></script>
	<!-- COOKIE -->
	<script type="text/javascript" src="js/jQuery-Cookie/jquery.cookie.min.js"></script>
	<!-- HUBSPOT MESSENGER -->
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger.min.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-flat.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-future.js"></script>
	<script src="js/script.js"></script>
	<!-- CLOSURE-LIBRARY -->
	<!-- <script src="closure-library/closure/goog/base.js"></script> -->
	<!-- ANGULAR-LIBRARY -->
	<script src="angular-1.5.0-rc.2/angular.js"></script>
	<!-- CUSTOM SCRIPT -->
	<script src="include/common.js"></script>
	<script>
	var app = angular.module("app", []);
	app.controller('ctrl', function($scope, $http, $httpParamSerializer, $injector, $window) {
		
		$scope.reload = function() {
			var reqDate = jQuery.param({});
			var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
			$http.post(
				"api/allianceMember/queryDetail", reqDate, reqConfig
			).success(function(data, status) {
				if (isErr(data)) {
					showErrMsg(data);
					return;
				}
				$scope.resp = data.response;
			}).error(function(data, status) {
				showNetworkErrMsg(data, status);
			});
		};
		
		$scope.submit = function() {
			var reqDate = jQuery.param({
				"weixinMchId":$scope.resp.weixinMchId,
				"weixinSignKey":$scope.resp.weixinSignKey,
				"addr": $scope.resp.addr,
				"phone": $scope.resp.phone,
				"desc": $scope.resp.desc,
				"checkInDesc": $scope.resp.checkInDesc,
				"qrcodeUrl": $scope.resp.qrcodeUrl,
				"website": $scope.resp.website,
				"weixinAppId": $scope.resp.weixinAppId,
				"weixinAppSecret": $scope.resp.weixinAppSecret,
				"weixinToken": $scope.resp.weixinToken,
				"weixinEncodingAesKey": $scope.resp.weixinEncodingAesKey,
				"weixinH5UrlMembershipService": $scope.resp.weixinH5UrlMembershipService,
				"weixinH5UrlConvenienceService": $scope.resp.weixinH5UrlConvenienceService,
				"weixinH5UrlEvent": $scope.resp.weixinH5UrlEvent,
				"weixinH5UrlArticle": $scope.resp.weixinH5UrlArticle,
				"weixinH5UrlEntrepreneurService": $scope.resp.weixinH5UrlEntrepreneurService,
				"weixinH5UrlEntrepreneur": $scope.resp.weixinH5UrlEntrepreneur,
				"weixinH5UrlPartner": $scope.resp.weixinH5UrlPartner
			});
			var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
			$http.post(
				"api/allianceMember/edit", reqDate, reqConfig
			).success(function(data, status) {
				$http.post(
						"api/weixin/updateMenu", reqConfig
					).success(function(data, status) {
						$scope.reload();
						isErr(data) ? showErrMsg(data) : showMsg('更新孵化器微信菜单成功！');
					}).error(function(data, status) {
						showNetworkErrMsg(data, status);
					});
			}).error(function(data, status) {
				showNetworkErrMsg(data, status);
			});
		}
		
		$scope.queryAllProvince = function() {
			var reqDate = jQuery.param({});
			var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
			$http.post(
				"api/region/queryAllProvince", reqDate, reqConfig
			).success(function(data, status) {
				if (isErr(data)) {
					showErrMsg(data);
					return;
				}
				$scope.provinceList = data.response;
			}).error(function(data, status) {
				showNetworkErrMsg(data, status);
			});
		}
		
		$scope.logout = function() {
			logout($window);
		};
	});
	</script>
	<script>
	jQuery(document).ready(function() {
		App.init();
		jQuery('#nav_admin_user').click();
		setTimeout(function () {
			var scope = angular.element('#app').scope();
			scope.reload();
			scope.queryAllProvince();
		}, 500);
	});
	</script>
	<!-- /JAVASCRIPTS -->
</body>
</html>